"""
進入爱逛卖家版
"""
import time

import yaml
from uiautomator2 import xpath


from page_object.guang_page import GuangPage
from resource.path_info import *
from util.tools import *

"""
客户服务
"""
class ClienServerPage(GuangPage):
    """
    客户服务
    """
    def send_message_to_client_server(self, d):
        print("send_message_to_client_server")
        d.xpath(client_server_input_box).wait(timeout=3.0)
        d.xpath(client_server_input_box).click()
        inputText = get_mill_time(self)
        d(focused=True).send_keys(inputText)
        d.xpath(client_server_send_btn).click()
        time.sleep(2)
        if d(text=inputText).exists:
            print("send message successfully")
        else:
            raise Exception("send message failed")
        if d(text=client_server_auto_reply_text).exists:
            print("receiver message successfully")
        else:
            raise Exception("receiver message failed")
        d.press("back")
        return self
